package com.zw.weiyi.util;

import java.lang.reflect.Field;

import com.zw.weiyi.phonesms.R;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.widget.AbsListView;
import android.widget.ListView;

/**
 * 自定义滚动条
 * 
 * @author Striver_zw 
 * Date 2014-12-13
 */
public class FiledDraw {
	// 自定义滚动条（模拟器无效）
	public static void setDraw(Context context,ListView listView) {
		try {
			Field f = AbsListView.class.getDeclaredField("mFastScroller");
			f.setAccessible(true);
			Object o = f.get(listView);
			f = f.getType().getDeclaredField("mThumbDrawable");
			f.setAccessible(true);
			Drawable drawable = (Drawable) f.get(o);
			drawable = context.getResources().getDrawable(R.drawable.ic_launcher);
			f.set(o, drawable);
			// Toast.makeText(context, f.getType().getName(), 1000).show();
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
}
